home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-04-21 | 4.6 KB | 166 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWRgnShp.h
- // Release Version: $ 1.0d1 $
- //
- // Creation Date: 3/28/94
- //
- // Copyright: © 1993, 1994 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWRGNSHP_H
- #define FWRGNSHP_H
-
- #ifndef FWSHAPE_H
- #include "FWShape.h"
- #endif
-
- #ifndef FWINK_H
- #include "FWInk.h"
- #endif
-
- #ifndef FWStyle_H
- #include "FWStyle.h"
- #endif
-
- // ----- OpenDoc Includes -----
-
- #ifndef _SHAPE_
- #include <Shape.h>
- #endif
-
- //========================================================================================
- // •• Forward Declarations
- //========================================================================================
-
- class FW_CGraphicContext;
- class FW_CRegionShapeRep;
- class XMPShape;
- class FW_COvalShape;
- class FW_CRoundRectShape;
- class FW_CArcShape;
- class FW_CLineShape;
- class FW_CRectShape;
-
- //========================================================================================
- // •• CLASS FW_CRegionShape
- //========================================================================================
-
- class FW_CRegionShape : public FW_CShape
- {
- //----------------------------------------------------------------------------------------
- // • Constructors
- //
- public:
- FW_CRegionShape();
- FW_CRegionShape(XMPShape* shape);
- FW_CRegionShape(const FW_CRect& rect);
-
- FW_CRegionShape(const FW_CRegionShape& other);
- FW_CRegionShape(FW_CRegionShapeRep* rep);
-
- //----------------------------------------------------------------------------------------
- // • Operators
- //
- public:
- FW_CRegionShape& operator=(const FW_CRegionShape& other);
- FW_CRegionShape& operator=(FW_CRegionShapeRep* other);
-
- FW_CRegionShapeRep* operator->() const
- {return (FW_CRegionShapeRep*)GetRep();}
-
- //----------------------------------------------------------------------------------------
- // • Conversion
- //
- public:
- operator FW_CRectShape() const;
- operator FW_COvalShape() const;
- operator FW_CRoundRectShape() const;
- operator FW_CArcShape() const;
- operator FW_CLineShape() const;
-
- //----------------------------------------------------------------------------------------
- // • Static Methods
- //
- public:
- static void DrawRegion(FW_CGraphicContext* graphicContext, XMPShape* xmpShape);
- };
-
- //==============================================================================
- // •• class FW_CRegionShapeRep
- //==============================================================================
-
- class FW_CRegionShapeRep : public FW_CShapeRep
- {
- friend class FW_CRegionShape;
-
- //------------------------------------------------------------------------------
- // • Constructors/Destructors
- //
- protected:
- FW_CRegionShapeRep();
- FW_CRegionShapeRep(XMPShape* xmpShape);
- FW_CRegionShapeRep(const FW_CRect& rect);
-
- virtual ~FW_CRegionShapeRep();
-
- //------------------------------------------------------------------------------
- // • Inherited API
- //
- public:
- // ----- Hit Testing -----
- virtual FW_HitTestPart HitTest(const FW_CPoint& test) const;
-
- // ----- Rendering -----
- virtual void Draw(FW_CGraphicContext* graphicContext);
- static void DrawRegion(FW_CGraphicContext* graphicContext, XMPShape* xmpShape);
-
- // ----- Transform -----
- virtual void Transform(XMPTransform* transform);
- virtual void InverseTransform(XMPTransform* transform);
-
- virtual void MoveShape(XMPCoordinate deltaX, XMPCoordinate deltaY);
- virtual void MoveShapeTo(XMPCoordinate x, XMPCoordinate y);
-
- // ----- Geometry -----
- virtual FW_CRect GetShapeBounds() const;
-
- // ----- Default shape -----
- virtual void SetAsDefault() const;
-
- // ----- Stream -----
- virtual void Flatten(FW_CWritableStream& stream);
- virtual void Unflatten(FW_CReadableStream& stream);
-
- //------------------------------------------------------------------------------
- // • New API
- //
- public:
- FW_CRegionShape Copy() const;
-
- void GetXMPShape(XMPShape* xmpShape) const
- {xmpShape->CopyFrom(fXMPShape);}
- void SetXMPShape(XMPShape* xmpShape);
-
- //------------------------------------------------------------------------------
- // • Data Members
- //
- private:
- XMPShape* fXMPShape;
- };
-
- //==============================================================================
- // •• Inlines
- //==============================================================================
-
- //------------------------------------------------------------------------------
- // • FW_CRegionShape::DrawRegion
- //------------------------------------------------------------------------------
- inline static void FW_CRegionShape::DrawRegion(FW_CGraphicContext* graphicContext, XMPShape* xmpShape)
- {
- FW_CRegionShapeRep::DrawRegion(graphicContext, xmpShape);
- }
-
- #endif
-